const pageSetup = {
    name: '页面标题', // 页面名称
    details: '', // 页面描述
    isBack: true, // 是否返回按钮
    titleHeight: 35, // 高度
    bgColor: 'rgba(241, 243, 249, 10)', // 背景颜色
    bgImg: '', // 背景图片
};

const state = {
    id: null,
    rightcom: '', // 右侧组件切换
    pageSetup: pageSetup,
    pageComponents: [],
    currentproperties: pageSetup, // 当前属性
    tableData: [], //表格数据
};

const mutations = {
    SET_ID: (state, data) => {
        state.id = data;
    },
    SET_RIGHT_COM: (state, data) => {
        state.rightcom = data;
    },
    // 页面设置
    SET_PAGE_SETUP: (state, data) => {
        state.pageSetup = data;
    },
    // 组件数据
    SET_PAGE_COMPONENTS: (state, data) => {
        state.pageComponents = data;
    },
    // 当前属性
    SET_CURRENT_PROPERTIES: (state, data) => {
        state.currentproperties = null;
        state.currentproperties = data;
    },
    //表格数据
    SET_TABLE_DATA: (state, data) => {
        state.tableData = data;
    },
    RESET_PAGE_COMPONENTS: (state) => {
        state.id = null;
        state.rightcom = '';
        state.pageSetup = pageSetup;
        state.currentproperties = null;
        state.pageComponents = [];
    },
};

const actions = {
    setId: ({ commit }, data) => {
        commit('SET_ID', data);
    },
    setRightcom: ({ commit }, data) => {
        commit('SET_RIGHT_COM', data);
    },
    // 页面设置
    setPageSetup: ({ commit }, data) => {
        commit('SET_PAGE_SETUP', data);
    },
    // 组件数据
    setPageComponents: ({ commit }, data) => {
        commit('SET_PAGE_COMPONENTS', data);
    },
    setCurrentproperties: ({ commit }, data) => {
        commit('SET_CURRENT_PROPERTIES', data);
    },
    //表格数据
    setTableData: ({ commit }, data) => {
        commit('SET_TABLE_DATA', data);
    },
    // 清除组件
    resetPageComponents: ({ commit }, data) => {
        commit('RESET_PAGE_COMPONENTS', data);
    },
};

export default {
    namespaced: true,
    state,
    mutations,
    actions,
};
